//
//  GuideMainHomeVC.m
//  Doctor
//
//  Created by 阳光 on 16/9/6.
//  Copyright © 2016年 阳光. All rights reserved.
//  使用手册界面

#import "GuideMainHomeVC.h"
#import "GuideList1VC.h"
#import "GuideList2VC.h"
#import "GuideList3VC.h"
#import "GuideList4VC.h"
#import "GuideList5VC.h"
#import "GuideList6VC.h"
#import "GuideList7VC.h"
#import "GuideList8VC.h"
#import "GuideList9VC.h"
#import "GuideList10VC.h"


static NSString *tableViewCellIdentifier=@"UITableViewCellIdentifier";

@interface GuideMainHomeVC ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView *guideMainHomeTableView;

//@property(nonatomic,strong)NSArray *guideMainHomeArr;

@end



@implementation GuideMainHomeVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title = NSLocalizedString(@"Operation Manual", nil);//@"使用手册";
    
//    _guideMainHomeArr=[NSArray array];
    
    [self initTableView];
    
}

-(void)initTableView
{
    // _guideMainHomeTableView
    _guideMainHomeTableView=[[UITableView alloc]initWithFrame:CGRectMake(0,1,APPW,APPH-49) style:UITableViewStylePlain];
    _guideMainHomeTableView.delegate=self;
    _guideMainHomeTableView.dataSource=self;
    _guideMainHomeTableView.hidden=NO;
    _guideMainHomeTableView.backgroundColor=MAIN_BACK_COLOR;
    _guideMainHomeTableView.showsVerticalScrollIndicator=NO;
    _guideMainHomeTableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    [self.view addSubview:_guideMainHomeTableView];
    [_guideMainHomeTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:tableViewCellIdentifier];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSArray *guideMainHomeArr=@[@"1.医生个人信息的修改",@"2.您的信息在用户端的展示",@"3.我的预约",@"4.设置视频预约安排",@"5.我的咨询",@"6.在线模式与离线模式",@"7.我的手术",@"8.患者管理",@"9.添加医嘱",@"10.论文管理"];
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:tableViewCellIdentifier];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text=guideMainHomeArr[indexPath.row];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kmargin*5;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *footView=[UIView new];
    return footView;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return kmargin*4;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
     // 获取_guideMainHomeTableView 当前选中的cell
    UITableViewCell *cell=[_guideMainHomeTableView cellForRowAtIndexPath:indexPath];
    
    if (indexPath.row==0)
    {
        GuideList1VC *guideList1VC=[GuideList1VC new];
        guideList1VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList1VC animated:NO];
    }
    else if (indexPath.row==1)
    {
        GuideList2VC *guideList2VC=[GuideList2VC new];
        guideList2VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList2VC animated:NO];
    }
    else if (indexPath.row==2)
    {
        GuideList3VC *guideList3VC=[GuideList3VC new];
         guideList3VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList3VC animated:NO];
    }
    else if (indexPath.row==3)
    {
        GuideList4VC *guideList4VC=[GuideList4VC new];
         guideList4VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList4VC animated:NO];
    }
    else if (indexPath.row==4)
    {
        GuideList5VC *guideList5VC=[GuideList5VC new];
         guideList5VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList5VC animated:NO];
    }
    else if (indexPath.row==5)
    {
        GuideList6VC *guideList6VC=[GuideList6VC new];
         guideList6VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList6VC animated:NO];
    }
    else if (indexPath.row==6)
    {
        GuideList7VC *guideList7VC=[GuideList7VC new];
         guideList7VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList7VC animated:NO];
    }
    else if (indexPath.row==7)
    {
        GuideList8VC *guideList8VC=[GuideList8VC new];
         guideList8VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList8VC animated:NO];
    }
    else if (indexPath.row==8)
    {
        GuideList9VC *guideList9VC=[GuideList9VC new];
         guideList9VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList9VC animated:NO];
    }
    else if (indexPath.row==9)
    {
        GuideList10VC *guideList10VC=[GuideList10VC new];
         guideList10VC.title=cell.textLabel.text;
        [self.navigationController pushViewController:guideList10VC animated:NO];
    }
}


// 间隙置边
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if ([tableView respondsToSelector:@selector(setSeparatorInset:)])
    {
        [tableView setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([tableView respondsToSelector:@selector(setLayoutMargins:)])
    {
        [tableView setLayoutMargins:UIEdgeInsetsZero];
    }
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)])
    {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}


@end
